#! /bin/sh

# Only one test uses this which calls syscall(SYS_sendfile)
# which is the only amd64 syscall that uses 7 arguments
# The output includes --trace-syscalls=yes which is very verbose
# but we only want to see the sendfile line

# the libc signature for sendfile is
#     int sendfile(int fd, int s, off_t offset, size_t nbytes,
#                  struct sf_hdtr *hdtr, off_t *sbytes, int flags);
# The testcase uses values from 101 to 107 for the arguments
# (to make it easy to match the testcase to the log output)
# Some of the arguments are printed as hex, not too bad.
# Argument 6 is an offset which seems to get added to some
# variable length base address before being sent to the syscall.
# I've checked with truss and ktrace, this doesn't come from Valgrind

grep "SYSCALL.*sendfile" |
sed 's/==.*//' |
awk '{l=length($9);$9="0x"substr($9, l-2, l);print}' |
sed -E 's/\[[0-9]+/[xxxxx/'

